<!DOCTYPE html>
<meta charset="utf-8">
<title>geom.polygon</title>
<body>
<script src="../../d3.js"></script>
<script>

var width = 960,
    height = 500;

var data = [ [ 40, 20 ], [ 40, 80 ], [ 130, 70 ]];
var polygon=d3.geom.polygon(data);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
	.datum(polygon)
	.attr("d", function(d) {
		return "M" + d.join("L") + "Z";
	})
	.attr("fill","none")
	.attr("stroke","green")
	.attr("stroke-width","2");
	
</script>